<template>
  <div style="padding: 10px">

    <!-- 卡片区域 -->
    <el-row :gutter="20">
      <el-col :span="8" v-for="(item, index) in tableData" :key="index" style="margin-bottom: 20px;">
        <el-card shadow="hover" style="height: 100%;">
          <div slot="header" class="clearfix">
            <span>订单号: {{ item.orderId }}</span>
            <el-button style="float: right; padding: 3px 0" type="text">详情</el-button>
          </div>
          <div>
            <p><strong>顾客号:</strong> {{ item.customerId }}</p>
            <p><strong>下单日期:</strong> {{ item.orderDate }}</p>
            <p><strong>金额:</strong> {{ item.totalAmount }}</p>
            <p><strong>订单状态:</strong>
              {{ statusOptions.find(option => option.value === item.status).label }}
            </p>
            <p><strong>地址:</strong> {{ item.shippingAddress }}</p>
            <p><strong>备注:</strong> {{ item.notes }}</p>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 底部分页 -->
<!--    <div style="margin: 10px 0">-->
<!--      <el-pagination-->
<!--          v-model:current-page="currentPage"-->
<!--          v-model:page-size="pageSize"-->
<!--          :page-sizes="[5, 10, 20]"-->
<!--          :small="small"-->
<!--          :disabled="disabled"-->
<!--          :background="background"-->
<!--          layout="total, sizes, prev, pager, next, jumper"-->
<!--          :total="total"-->
<!--          @size-change="handleSizeChange"-->
<!--          @current-change="handleCurrentChange"-->
<!--      />-->
<!--    </div>-->
  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: 'FinancialManager',
  components: {},
  data() {
    return {
      form: {},
      dialogVisible: false,
      search: '',
      currentPage: 1,
      total: 10,
      pageSize: 10,
      tableData: [],
      orderIdQuery: '', // 新增房间名称查询条件变量
      statusOptions: [
        {label: '待处理', value: '待处理'},
        {label: '已发货', value: '已发货'},
        {label: '已完成', value: '已完成'}
      ]
    }
  },
  methods: {
    handleSizeChange() {
      this.load();
    },
    handleCurrentChange() {
      this.load();
    },
    load() {
      request.get("/trader/getOrderListPage", {
        params: {
          pageNumber: this.currentPage,
          pageSize: this.pageSize,
          search: this.search
        }
      }).then(res => {
        this.tableData = res.data.list;
        this.total = res.data.total;
      })
    }
  },
  created() {
    this.load();
  }
}
</script>

<style scoped>
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both
}

.operation-center {
  text-align: center;
}
</style>
